import 'package:flutter/material.dart';
import 'package:pabu/utils/DioUtils.dart';

class RequestPage extends StatefulWidget {
  @override
  _RequestPageState createState() => new _RequestPageState();
}

class _RequestPageState extends State<RequestPage> {
  @override
  Widget build(BuildContext context) {
    return _buildTabBar();
  }

  String _content = "123";

  Widget _buildTabBar() {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("Request"),
        ),
        body: Container(
          child: Column(
            children: <Widget>[
              RaisedButton(
                child: Text("data"),
                onPressed: () {
                  getMsg();
                },
              ),
              Text(_content),
            ],
          ),
        ),
      ),
    );
  }

  getMsg() async {
    DioUtils.request("http://39.100.130.232:8080/v1/user/select/1", method: "get", onSuccess: (data){
      setState(() {
        _content = data.toString();
      });
    });
  }
}
